<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="sektor" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{sektorHome.managed ? 'Edit' : 'Add'} Sektor</f:facet>


            <s:decorate id="idField" template="layout/edit.xhtml">
                <ui:define name="label">Id</ui:define>
                <h:inputText id="id"
                       required="true"
                          value="#{sektorHome.instance.id}"
                           size="26">
                    <a:support event="onblur" reRender="idField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>



            <s:decorate id="sektorAdiField" template="layout/edit.xhtml">
                <ui:define name="label">Sektor adi</ui:define>
                <h:inputText id="sektorAdi"
                       required="true"
                           size="50"
                      maxlength="50"
                          value="#{sektorHome.instance.sektorAdi}">
                    <a:support event="onblur" reRender="sektorAdiField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="sektorKoduField" template="layout/edit.xhtml">
                <ui:define name="label">Sektor kodu</ui:define>
                <h:inputText id="sektorKodu"
                       required="true"
                           size="5"
                      maxlength="5"
                          value="#{sektorHome.instance.sektorKodu}">
                    <a:support event="onblur" reRender="sektorKoduField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>



            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{sektorHome.persist}"
                       disabled="#{!sektorHome.wired}"
                       rendered="#{!sektorHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{sektorHome.update}"
                       rendered="#{sektorHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{sektorHome.remove}"
                      immediate="true"
                       rendered="#{sektorHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Sektor.xhtml"
                rendered="#{sektorHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty sektorFrom ? 'SektorList' : sektorFrom}.xhtml"
                rendered="#{!sektorHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Bolums">
        <h:form styleClass="association" id="bolumsChildren">

            <h:outputText value="There are no bolums associated with this sektor."
                       rendered="#{empty sektorHome.bolums}"/>

            <rich:dataTable value="#{sektorHome.bolums}"
                           var="_bolum"
                      rendered="#{not empty sektorHome.bolums}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="bolumsTable">
                <rich:column sortBy="#{_bolum.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_bolum.id}">
                        <f:convertNumber/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_bolum.bolumAdi}">
                    <f:facet name="header">Bolum adi</f:facet>
                    <h:outputText value="#{_bolum.bolumAdi}"/>
                </rich:column>
                <rich:column sortBy="#{_bolum.bolumKodu}">
                    <f:facet name="header">Bolum kodu</f:facet>
                    <h:outputText value="#{_bolum.bolumKodu}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{sektorHome.managed}" id="bolums">
        <div class="actionButtons">
            <s:button id="addbolum"
                   value="Add bolum"
                    view="/BolumEdit.xhtml"
             propagation="none">
                 <f:param name="sektorId"
                         value="#{sektorHome.instance.id}"/>
                 <f:param name="bolumFrom" value="Sektor"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Kullanici is tecrubeleris">
        <h:form styleClass="association" id="kullaniciIsTecrubelerisChildren">

            <h:outputText value="There are no kullaniciIsTecrubeleris associated with this sektor."
                       rendered="#{empty sektorHome.kullaniciIsTecrubeleris}"/>

            <rich:dataTable value="#{sektorHome.kullaniciIsTecrubeleris}"
                           var="_kullaniciIsTecrubeleri"
                      rendered="#{not empty sektorHome.kullaniciIsTecrubeleris}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="kullaniciIsTecrubelerisTable">
                <rich:column sortBy="#{_kullaniciIsTecrubeleri.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_kullaniciIsTecrubeleri.id}">
                        <f:convertNumber/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_kullaniciIsTecrubeleri.firmaAdi}">
                    <f:facet name="header">Firma adi</f:facet>
                    <h:outputText value="#{_kullaniciIsTecrubeleri.firmaAdi}"/>
                </rich:column>
                <rich:column sortBy="#{_kullaniciIsTecrubeleri.iseBaslamaTarihi}">
                    <f:facet name="header">Ise baslama tarihi</f:facet>
                    <h:outputText value="#{_kullaniciIsTecrubeleri.iseBaslamaTarihi}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_kullaniciIsTecrubeleri.istenAyrilmaTarihi}">
                    <f:facet name="header">Isten ayrilma tarihi</f:facet>
                    <h:outputText value="#{_kullaniciIsTecrubeleri.istenAyrilmaTarihi}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{sektorHome.managed}" id="kullaniciIsTecrubeleris">
        <div class="actionButtons">
            <s:button id="addkullaniciIsTecrubeleri"
                   value="Add kullaniciIsTecrubeleri"
                    view="/KullaniciIsTecrubeleriEdit.xhtml"
             propagation="none">
                 <f:param name="sektorId"
                         value="#{sektorHome.instance.id}"/>
                 <f:param name="kullaniciIsTecrubeleriFrom" value="Sektor"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
